package com.skd.druid.core;

import com.alibaba.druid.support.http.StatViewServlet;
import com.haulmont.cuba.core.sys.AppContext;

import java.util.HashSet;

public class CUBAStatViewServlet extends StatViewServlet {
    {
        String[] names = AppContext.getPropertyNames();
        for (int i = 0; i < names.length; i++) {
            String n = names[i];
            if(n.startsWith("druid.")){
                pNames.add(n.split("\\.")[1]);
            }
        }
    }
    final static HashSet<String> pNames=new HashSet<String>();
    @Override
    public String getInitParameter(String name) {
        if(pNames.contains(name)){
            return AppContext.getProperty("druid." + name);
        }
        return super.getInitParameter(name);
    }

    public CUBAStatViewServlet(){
    }
    public final static String  NAME="SKDStatViewServlet";

}